﻿using Infrastructure.Attribute;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZR.Model.Models.ProductionControl;
using ZR.Service.IService.ProductionControl;

namespace ZR.Service.Service.ProductionControl
{
    [AppService(ServiceType = typeof(IEquipmentFormulaService), ServiceLifetime = LifeTime.Transient)]
    public class EquipmentFormulaService : BaseService<EquipmentFormula>, IEquipmentFormulaService
    {
        public List<EquipmentFormula> QueryByRecipeId(int fourmla)
        {
            return QueryListByClause(qbc => qbc.RecipeId.Equals(fourmla)).ToList();
        }

        public List<EquipmentFormula> QueryByStatonAndLineAndFormula(string stationCode, string lineCode, int formulaId)
        {
            return QueryListByClause(qbc => qbc.StationCode.Equals(stationCode) && qbc.ProductionLine.Equals(lineCode) && qbc.RecipeId.Equals(formulaId)).ToList();
        }

        public Task<bool> UpdateList(List<EquipmentFormula> formulas)
        {
            return UpdateAsync(formulas);
        }
    }
}